package com.cbb.lease.controller;

import com.cbb.lease.pojo.entity.CarConfig;
import com.cbb.lease.pojo.entity.Type;
import com.cbb.lease.service.CarConfigService;
import com.gsj.common.pojo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-eighth01
 * @description: 这是一个 汽车 配置controller
 * @author: 陈斌斌
 * @create: 2021-07-24 14:57
 **/
@RestController
@RequestMapping("lease/config")
@Api(value = "lease/Config")
public class CarConfigController {
    @Resource
    private CarConfigService carConfigService;

    @GetMapping("getAllConfig")
    @ApiOperation(value = "getAllConfig",httpMethod = "get")
    public R getAllConfig(){
        return carConfigService.getAllConfig();
    }

    @PostMapping("getAllConfigPage/{currentPage}/{pageSize}")
    @ApiOperation(value = "getAllConfigPage",httpMethod = "post")
    public R  getAllConfigPage(@PathVariable("currentPage")Integer currentPage,
                             @PathVariable("pageSize")Integer pageSize,
                             @RequestBody CarConfig config){
        return carConfigService.getAllConfigPage(currentPage,pageSize,config);
    }


    @ApiOperation(value = "delById",httpMethod = "delete")
    @DeleteMapping("delById")
    public R delById(@ApiParam(value = "类型主键ID")
                             Integer id){
        return carConfigService.delById(id);
    }

    @ApiOperation(value = "updateConfig",httpMethod = "put")
    @PutMapping("updateConfig")
    public R updateConfig(@ApiParam(value = "config实体类")
                          @RequestBody CarConfig config){
        return carConfigService.updateConfig(config);
    }


    @ApiOperation(value = "addConfig",httpMethod = "post")
    @PostMapping ("addConfig")
    public R addConfig(@ApiParam(value = "config实体类")
                     @RequestBody CarConfig config){
        return carConfigService.addConfig(config);
    }





}
